package com.greet.controller.admin;

import com.greet.result.Result;
import com.greet.service.WorkspaceService;
import com.greet.vo.BusinessDataVO;
import com.greet.vo.DishOverViewVO;
import com.greet.vo.OrderOverViewVO;
import com.greet.vo.SetmealOverViewVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.LocalDateTime;

@RestController
@RequestMapping("/admin/workspace")
@Slf4j
public class WorkspaceController {
    @Autowired
    private WorkspaceService workspaceService;

    @GetMapping("/businessData")
    public Result<BusinessDataVO> businessData(){
        BusinessDataVO dataVO = workspaceService.businessData(LocalDate.now());

        return Result.success(dataVO);
    }

    @GetMapping("/overviewSetmeals")
    public Result<SetmealOverViewVO> overviewSetmeals(){
        SetmealOverViewVO viewVO = workspaceService.overviewSetmeals();
        return Result.success(viewVO);
    }

    @GetMapping("/overviewDishes")
    public Result<DishOverViewVO> overviewDishes(){
        DishOverViewVO viewVO = workspaceService.overviewDishes();
        return Result.success(viewVO);
    }

    @GetMapping("/overviewOrders")
    public Result<OrderOverViewVO> overviewOrders(){
        OrderOverViewVO viewVO = workspaceService.overviewOrders(LocalDate.now());
        return Result.success(viewVO);
    }
}
